package be.kuleuven.cs.mop.gui.dialogs;


import java.awt.Frame;
import java.util.List;

import be.kuleuven.cs.mop.app.controllers.Controllers;
import be.kuleuven.cs.mop.domain.model.Project;



/**
 * {@link RemoveDialog} for the "Remove Project" use case
 */
public class RemoveProjectDialog extends RemoveDialog<Project> {
	private static final long serialVersionUID = 1L;
	
	
	public RemoveProjectDialog(final Frame parent, final Controllers controllers) {
		super(parent, "Remove Project", controllers);
	}
	
	
	
	@Override
	protected Project[] getItems() throws Exception {
		final List<Project> projects =
			getControllers().getControllerProjects().getProjects();
		return projects.toArray(new Project[projects.size()]);
	}
	
	@Override
	protected void remove(final Project item) throws Exception {
		getControllers().getControllerProjects().removeProject(item);
	}
	
	@Override
	protected String toString(final Project item) {
		return item.getDescription();
	}
	
}